<?php

class ArtistProtectedController extends Controller{
	var $login_url = '';
	var $role = 'artist';
	
	function ArtistProtectedController($f = null){
		parent::Controller();
		$this->load->helper('url');
		$this->login_url = CMF_URL . 'artistlogin';
		$params = null;
		if( $f && file_exists($f) ){
			$params = array('file' => $f);
		}else{
			$params = array('file' => CMF_PASSWORD_FILE);
		}
		$this->load->library('Login_lib', $params);
		if( !$this->isLoggedIn() ){
			if( $this->login_url ){
				redirect($this->login_url);
			}else{
				show_error('Sorry, a login page has not been provided!');
			}
		}
	}
	
	function isLoggedIn(){
		return $this->login_lib->isLoggedIn($this->role);
	}
}
?>